package com.yanqu.road.server.cmd.activity.unionwar;

import com.yanqu.road.pb.activity.unionwar.UnionWarActivityServerProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.manger.activity.unionwar.UnionPhaseWarMgr;
import com.yanqu.road.server.manger.activity.unionwar.UnionWar;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = GameProtocol.S_UNION_WAR_SYNC_CONDITION_ACHIEVE, desc = "群英争霸同步竞猜各档位达成人数")
public class UnionWarSyncConditionAchieveCmd implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        UnionWarActivityServerProto.UnionWarConditionAchieveMsg msg = UnionWarActivityServerProto.UnionWarConditionAchieveMsg.parseFrom(packet.getBytes());
        UnionWar unionWar = UnionPhaseWarMgr.getUnionWar(msg.getActivityId());
        if (unionWar != null) {
            unionWar.conditionAchieveInfoSync(msg);
        }
    }
}
